package com.sara.dao;

import com.sara.entity.Movie;
import com.sara.entity.Type;
import com.sara.util.DbHelp;
import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.GenerousBeanProcessor;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.util.List;

public class TypeDao {

    
    public List<Type> queryByMovieId(Integer id) {

        String sql = "select * from t_movie m, t_movie_type mt where m.id = mt.movie_id and mt.type_id = ?";
        return DbHelp.query(sql,
                new  BeanListHandler<Type>(Type.class, new BasicRowProcessor(new GenerousBeanProcessor())), id);

    }
}
